package com.yiliao.control;

import com.yiliao.service.WeiXinPaySetUpService;
import com.yiliao.util.MessageUtil;
import com.yiliao.util.PrintUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

/**
 * ace设置control
 * @author Administrator
 *
 */
@Controller
@RequestMapping("admin")
public class HzfAliPaySetUpControl {

	@Autowired
	private WeiXinPaySetUpService weiXinPaySetUpService;
	/**
	 * 获取微信支付设置列表
	 * @param page
	 * @param response
	 */
	@RequestMapping("getHzfAliPaySetUpList")
	@ResponseBody
	public void getWeiXinPaySetUpList(int page, HttpServletResponse response){
		
		PrintUtil.printWri(this.weiXinPaySetUpService.getHzfAliPaySetUpList(page), response);
		
	}
	
	/**
	 * 修改或者删除
	 */
	@RequestMapping("setHzfAliPaySetUp")
	@ResponseBody
	public void setAcePaySetUp(Integer t_id,String t_alipay_appid,String t_alipay_private_key,String t_alipay_public_key,int t_pay_id,HttpServletResponse response) {

		MessageUtil mu = this.weiXinPaySetUpService.setHzfAliPaySetUp(t_id, t_alipay_appid, t_alipay_private_key, t_alipay_public_key,t_pay_id);

		PrintUtil.printWri(mu, response);
	}
	
	/**
	 * 
	 * @param t_id
	 * @param response
	 */
	@RequestMapping("delHzfAliPaySetUp")
	@ResponseBody
	public void delWeiXinPaySetUp(int t_id ,HttpServletResponse response){
		
		MessageUtil mu = this.weiXinPaySetUpService.delHzfAliPaySetUp(t_id);
		
		PrintUtil.printWri(mu, response);
	}
	
	/**
	 * 获取微信支付渠道列表
	 * @return
	 */
	@RequestMapping(value= {"getHzfAliPayDeployList"},method = RequestMethod.POST)
	@ResponseBody
	public MessageUtil getWxPayDeployList() {
		
		return weiXinPaySetUpService.getHzfAliPayDeployList();
	}
	
}
